#!/bin/bash
export oldpwd=$PWD
export date="$(date +%Y-%m-%d-%H:%M:%S)"
export Cellar=/usr/local/Cellar
cd ~
echo "---$(date)开始---" >> ".ApacheInstall.${date}.log"
echo "正在克隆Git仓库到本地..."
git clone https://gitee.com/DevBlog/httpd.git ."${date}".tmp >> ".ApacheInstall.${date}.log"
echo "---以上为克隆日志---" >> ".ApacheInstall.${date}.log"
cd ".${date}".tmp
echo "准备安装中..."
chmod -R 755 .
./configure --enable-load-all-modules --with-apr=$Cellar/apr/1.7.0 --with-apr-util=$Cellar/apr-util/1.6.1_3 --with-pcre=$Cellar/pcre/8.44 --with-ssl=$Cellar/../opt/openssl@1.1/ --with-jansson=$Cellar/jansson/2.12 --with-curl=$Cellar/curl/7.69.1 >> "../.ApacheInstall.${date}.log"
echo "---以上为准备安装日志---" >> "../.ApacheInstall.${date}.log"
echo "准备安装完成，开始安装..."
make >> "../.ApacheInstall.${date}.log"
make install >> "../.ApacheInstall.${date}.log"
echo "---以上为安装日志---" >> "../.ApacheInstall.${date}.log"
echo "---$(date)完成安装---" >> "../.ApacheInstall.${date}.log"
echo "安装完成"
cd ..
echo "正在清除中..."
rm -rf ".${date}.tmp"
echo "正在打开安装日志..."
open -e ".ApacheInstall.${date}.log"
cd $oldpwd
